﻿using LxCFD;
using Prism.Mvvm;
using System.Collections.Generic;


namespace TimeSolve
{
    public partial class MeshVM
    {
        public class ContactVM : BindableBase
        {
            public ContactVM(FvContact contact)
            {
                this.contact = contact;
            }
            FvContact contact;
            #region 几何
            public string name
            {
                get => contact.name;
                set
                {
                    contact.name = value;
                    RaisePropertyChanged("name");
                }
            }

            public bool isConode
            {
                get => contact.IsConode;
            }

            public ZoneVM ownerZone { get; set; }
            public ThreadVM ownerThread { get; set; }
            public ZoneVM neighborZone { get; set; }
            public ThreadVM neighborThread { get; set; }
            #endregion

            public double S
            {
                get
                {
                    if (contact.EnergySource is Value1Const.Double vc)
                        return vc.Number;
                    else
                        return 0;
                }
                set
                {
                    contact.EnergySource = new Value1Const.Double(value);
                    RaisePropertyChanged("S");
                }
            }

            public double Tau
            {
                get
                {
                    if (contact.ThermalConductivity is Value1Const.Double vc)
                        return vc.Number;
                    else
                        return 0;
                }
                set
                {
                    contact.ThermalConductivity = new Value1Const.Double(value);
                    RaisePropertyChanged("Tau");
                }
            }

            public double Thickness
            {
                get
                {
                    if (contact.Thickness is Value1Const.Double vc)
                        return vc.Number;
                    else
                        return 0;
                }
                set
                {
                    contact.Thickness = new Value1Const.Double(value);
                    RaisePropertyChanged("Thickness");
                }
            }

            //public FieldsBase_OnBound fields { get => _fields; set => _fields = value; }
            //private FieldsBase_OnBound _fields;

            //public AMGSolverInContact AMGSolverInContact { get; set; } = new AMGSolverInContact();
            //IndexNumber IProvideContactTopology.getOwnerIndexs()
            //{
            //    return ownerThread.ThreadIndex;
            //}

            //IndexNumber IProvideContactTopology.getNeighborIndexs()
            //{
            //    return neighborThread.ThreadIndex;
            //}
        }

    }

}
//public void applySettings()
//{
//    PhysicalModelTranslater.ToContactFieldsAndApplySettings(ref _fields, this);
//}

//public struct Cell
//{
//    public CellFace[] cellFaces;
//}
//public struct CellFace
//{
//    public CellFace (int threadInZone,int faceInThread)
//    {
//        this.threadInZone = threadInZone;
//        this.faceInThread = faceInThread;
//    }
//    public int threadInZone;
//    public int faceInThread;
//}

//public Zone coupledZone { get=>_coupledZone; set { _coupledZone = value;RaisePropertyChanged("coupledZone"); } }
//public Thread coupledThreaad { get=>_coupledThread; set { _coupledThread = value;RaisePropertyChanged("coupledThreaad"); } }